package com.mida.app.report.controller;

import com.mida.app.report.process.DocReportServiceLockProcess;
import com.mida.bms.report.entity.DocReportServiceLock;
import com.mida.tool.common.result.ActionResult;
import com.mida.tool.common.result.ListResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName: DocReportServiceLockController
 * @Description: 报告业务锁控制层
 * @Author: wang xiao le
 * @Date: 2021/7/28 10:51
 **/
@RestController
@RequestMapping("/docReportServiceLock")
@CrossOrigin
@Slf4j
public class DocReportServiceLockController {

    @Autowired
    private DocReportServiceLockProcess docReportServiceLockProcess;


    /**
     * 获取锁
     *
     * @param docReportServiceLock 锁对象
     * @return 锁定报告人名称
     */
    @PostMapping(value = "/select", consumes = {"application/json;charset=UTF-8"})
    public ListResult<String> select(@RequestBody DocReportServiceLock docReportServiceLock) {

       return docReportServiceLockProcess.select(docReportServiceLock);
    }


    /**
     * 添加锁
     *
     * @param docReportServiceLock
     * @return
     */
    @PostMapping(value = "/add", consumes = {"application/json;charset=UTF-8"})
    public ListResult<String> add(@RequestBody DocReportServiceLock docReportServiceLock) {
        return docReportServiceLockProcess.add(docReportServiceLock);
    }
    /**
     * 删除锁
     *
     * @param docReportServiceLock 锁对象
     * @return null
     */
    @PostMapping(value = "/delete", consumes = {"application/json;charset=UTF-8"})
    public ActionResult delete(@RequestBody DocReportServiceLock docReportServiceLock) {

            return docReportServiceLockProcess.delete(docReportServiceLock);

    }



}
